﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BO
{
    [Serializable()]
    public class ListCriteria
    {
        private String _customJoin = string.Empty;
        public String CustomJoin
        {
            get { return _customJoin; }
            set
            {
                if (value == null)
                {
                    _customJoin = string.Empty;
                }
                else
                {
                    _customJoin = value.Trim();
                }
            }
        }

        private String _filter = string.Empty;
        public String Filter
        {
            get { return _filter; }
            set
            {
                if (value == null)
                {
                    _filter = string.Empty;
                }
                else
                {
                    _filter = value.Trim();
                }
            }
        }
        private String _sortString = string.Empty;
        public String SortString
        {
            get { return _sortString; }
            set
            {
                if (value == null)
                {
                    _sortString = string.Empty;
                }
                else
                {
                    _sortString = value.Trim();
                }
            }
        }

        private Int32 _topInt = 0;
        public Int32 TopInt
        {
            get { return _topInt; }
            set
            {
                _topInt = value;
            }
        }
        private Boolean _isDistinct = false;
        public Boolean IsDistinct
        {
            get { return _isDistinct; }
            set
            {
                _isDistinct = value;
            }
        }
        SerSqlParameter[] _Parameters;
        public SerSqlParameter[] Parameters
        {
            get { return _Parameters; }
            set
            {
                _Parameters = value;
            }
        }
        public ListCriteria(string pFilter)
            : this(pFilter, "")
        {
        }
        public ListCriteria(string pFilter, string pSortString)
        {
            Filter = pFilter;
            SortString = pSortString;
        }
        public ListCriteria(string pFilter, string pSortString, int pTopInt)
        {
            Filter = pFilter;
            SortString = pSortString;
            TopInt = pTopInt;
        }
        public ListCriteria(string pCustomJoin, string pFilter, string pSortString)
        {
            CustomJoin = pCustomJoin;
            Filter = pFilter;
            SortString = pSortString;
        }
        public ListCriteria(string pCustomJoin, string pFilter, string pSortString, bool pIsDistinct)
        {
            CustomJoin = pCustomJoin;
            Filter = pFilter;
            SortString = pSortString;
            IsDistinct = pIsDistinct;
        }
        public ListCriteria(string pCustomJoin, string pFilter, string pSortString, int pTopInt)
        {
            CustomJoin = pCustomJoin;
            Filter = pFilter;
            SortString = pSortString;
            TopInt = pTopInt;
        }

        public ListCriteria(string pCustomJoin, string pFilter, string pSortString, int pTopInt, bool pIsDistinct, params  SerSqlParameter[] parameters)
        {
            CustomJoin = pCustomJoin;
            Filter = pFilter;
            SortString = pSortString;
            TopInt = pTopInt;
            IsDistinct = pIsDistinct;
            Parameters = parameters;
        }
    }
}
